package mo.tags.enums;

import java.util.Arrays;

public class L204 {

    public int countPrimes(int n) {
        int[] primes = new int[n];
        Arrays.fill(primes, 1);
        int ans = 0;
        for (int i = 2; i < n; i++) {
            if (primes[i] == 1) {
                ans++;
            }
            if ((long) i*i < n) {
                for (int j = i*i; j < n; j+=i) {
                    primes[j] = 0;
                }
            }
        }
        return ans;
    }


    public static void main(String[] args) {
        L204 test = new L204();
        System.out.println(test.countPrimes(10));
    }
}
